<?php
session_start();
require 'funcoes_js.js';
if (isset($_SESSION['sessao_ok'])){

?>
<?php
$sql = "SELECT id, titulo,corpo,ativo,foto,url 
        FROM noticias
		ORDER BY id DESC LIMIT 6
		";
	
$resultados = mysql_query($sql)
                  	      or die (mysql_error());
if (@mysql_num_rows($resultado) == 0)
                  	      echo("");				   
?>
	<div id="rightContent">
    <table width="660" height="150px" border="0">
<?php
$cont = 1;
while ($res=mysql_fetch_array($resultados)) {
	$id = $res[0];
	$titulo = $res[1];
	$texto = $res[2];
	$img = $res [4];
	$Total= $id;
	$url = $res[5];
?>
        <tr><td width="70" height="1px" style="border-bottom: 4px solid #06F"><li style="list-style:none;"><a href="home.php?id=nav/ExibeNoticias&idN=<?php echo $id?>&urlext=<?php echo $url ?>" target="_blank"><img src="<?php echo $img ?>"  alt="Casa" title="" height="64px" width="64px" /></a></td>
<?php
 
 if (strlen($url)>0){
       ?><td width="362" style="border-bottom: 4px solid #06F"><h4><a href="<?php echo $url ?>" target="_blank"> <?php echo utf8_encode($titulo)?></a></h4></td>
    <?php }else{
        ?> <td width="194" style="border-bottom: 4px solid #06F"><h4><a href="home.php?id=nav/ExibeNoticias&idN=<?php echo $id?>&urlext=<?php echo $url ?>" target="_blank"><?php echo utf8_encode($titulo)?>
      </a></h4></td></tr>
   
          <?php }?>
</li>
<?php } ?>  
</table>
<a href="#" style="color:red"> Veja Todas as Notícias </a>
</div>
<?php
}else{
?>
<script language= "JavaScript">
	redirecionar();
</script>
<?php
}
?>
